package com.sky.skyopsserver.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 主机机器信息表
 * @TableName host
 */
@TableName(value ="host")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Host implements Serializable {
    /**
     * 主键唯一ID
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 机器名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * IDC机房名称
     */
    @TableField(value = "room_name")
    private String roomName;

    /**
     * IDC机房唯一ID
     */
    @TableField(value = "room_id")
    private Long roomId;

    /**
     * 所属主机组名称
     */
    @TableField(value = "group_name")
    private String groupName;

    /**
     * 所属主机组唯一ID
     */
    @TableField(value = "group_id")
    private Long groupId;

    /**
     * 公网IP地址
     */
    @TableField(value = "public_host")
    private String publicHost;

    /**
     * 私有IP地址
     */
    @TableField(value = "private_host")
    private String privateHost;

    /**
     * 端口
     */
    @TableField(value = "port")
    private Integer port;

    /**
     * 凭据
     */
    @TableField(value = "credential")
    private String credential;

    /**
     * 机器类型
     */
    @TableField(value = "type")
    private String type;

    /**
     * 系统版本
     */
    @TableField(value = "os_version")
    private String osVersion;

    /**
     * 用于SSH连接的地址
     */
    @TableField(value = "ssh_host")
    private String sshHost;

    /**
     * CPU数量
     */
    @TableField(value = "cpu_count")
    private Integer cpuCount;

    /**
     * CPU型号
     */
    @TableField(value = "cpu_name")
    private String cpuName;

    /**
     * 内存大小
     */
    @TableField(value = "memory")
    private Double memory;

    /**
     * 硬盘信息
     */
    @TableField(value = "disk_info")
    private String diskInfo;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    /**
     * 上架时间
     */
    @TableField(value = "listing_time")
    private LocalDateTime listingTime;

    /**
     * 下架时间
     */
    @TableField(value = "delisting_time")
    private LocalDateTime delistingTime;

    /**
     * 过期时间
     */
    @TableField(value = "expiration_time")
    private LocalDateTime expirationTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Host other = (Host) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getRoomName() == null ? other.getRoomName() == null : this.getRoomName().equals(other.getRoomName()))
            && (this.getRoomId() == null ? other.getRoomId() == null : this.getRoomId().equals(other.getRoomId()))
            && (this.getGroupName() == null ? other.getGroupName() == null : this.getGroupName().equals(other.getGroupName()))
            && (this.getGroupId() == null ? other.getGroupId() == null : this.getGroupId().equals(other.getGroupId()))
            && (this.getPublicHost() == null ? other.getPublicHost() == null : this.getPublicHost().equals(other.getPublicHost()))
            && (this.getPrivateHost() == null ? other.getPrivateHost() == null : this.getPrivateHost().equals(other.getPrivateHost()))
            && (this.getPort() == null ? other.getPort() == null : this.getPort().equals(other.getPort()))
            && (this.getCredential() == null ? other.getCredential() == null : this.getCredential().equals(other.getCredential()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getOsVersion() == null ? other.getOsVersion() == null : this.getOsVersion().equals(other.getOsVersion()))
            && (this.getSshHost() == null ? other.getSshHost() == null : this.getSshHost().equals(other.getSshHost()))
            && (this.getCpuCount() == null ? other.getCpuCount() == null : this.getCpuCount().equals(other.getCpuCount()))
            && (this.getCpuName() == null ? other.getCpuName() == null : this.getCpuName().equals(other.getCpuName()))
            && (this.getMemory() == null ? other.getMemory() == null : this.getMemory().equals(other.getMemory()))
            && (this.getDiskInfo() == null ? other.getDiskInfo() == null : this.getDiskInfo().equals(other.getDiskInfo()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getListingTime() == null ? other.getListingTime() == null : this.getListingTime().equals(other.getListingTime()))
            && (this.getDelistingTime() == null ? other.getDelistingTime() == null : this.getDelistingTime().equals(other.getDelistingTime()))
            && (this.getExpirationTime() == null ? other.getExpirationTime() == null : this.getExpirationTime().equals(other.getExpirationTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getRoomName() == null) ? 0 : getRoomName().hashCode());
        result = prime * result + ((getRoomId() == null) ? 0 : getRoomId().hashCode());
        result = prime * result + ((getGroupName() == null) ? 0 : getGroupName().hashCode());
        result = prime * result + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
        result = prime * result + ((getPublicHost() == null) ? 0 : getPublicHost().hashCode());
        result = prime * result + ((getPrivateHost() == null) ? 0 : getPrivateHost().hashCode());
        result = prime * result + ((getPort() == null) ? 0 : getPort().hashCode());
        result = prime * result + ((getCredential() == null) ? 0 : getCredential().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getOsVersion() == null) ? 0 : getOsVersion().hashCode());
        result = prime * result + ((getSshHost() == null) ? 0 : getSshHost().hashCode());
        result = prime * result + ((getCpuCount() == null) ? 0 : getCpuCount().hashCode());
        result = prime * result + ((getCpuName() == null) ? 0 : getCpuName().hashCode());
        result = prime * result + ((getMemory() == null) ? 0 : getMemory().hashCode());
        result = prime * result + ((getDiskInfo() == null) ? 0 : getDiskInfo().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getListingTime() == null) ? 0 : getListingTime().hashCode());
        result = prime * result + ((getDelistingTime() == null) ? 0 : getDelistingTime().hashCode());
        result = prime * result + ((getExpirationTime() == null) ? 0 : getExpirationTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", roomName=").append(roomName);
        sb.append(", roomId=").append(roomId);
        sb.append(", groupName=").append(groupName);
        sb.append(", groupId=").append(groupId);
        sb.append(", publicHost=").append(publicHost);
        sb.append(", privateHost=").append(privateHost);
        sb.append(", port=").append(port);
        sb.append(", credential=").append(credential);
        sb.append(", type=").append(type);
        sb.append(", osVersion=").append(osVersion);
        sb.append(", sshHost=").append(sshHost);
        sb.append(", cpuCount=").append(cpuCount);
        sb.append(", cpuName=").append(cpuName);
        sb.append(", memory=").append(memory);
        sb.append(", diskInfo=").append(diskInfo);
        sb.append(", remark=").append(remark);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", listingTime=").append(listingTime);
        sb.append(", delistingTime=").append(delistingTime);
        sb.append(", expirationTime=").append(expirationTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}